using System;

namespace SQLRunnerLib.Util
{
	/// <summary>
	/// Summary description for LineUsage.
	/// </summary>
	public class LineUsage
	{
		private LineUsage() {}

		public static void Print() {
			Console.WriteLine(string.Empty);
			Console.WriteLine("SQL Server Runner comes with ABSOLUTELY NO WARRANTY");
			Console.WriteLine(string.Empty);
			Console.WriteLine("Usage: SQLRunnerCommand [flags] -p:<project file> [options] ");
			Console.WriteLine(string.Empty);
			Console.WriteLine("Flags:");
			Console.WriteLine(" -h\t\tShows this help");
			Console.WriteLine(" -t\t\tIndicates to use a trusted connection");
			Console.WriteLine(string.Empty);
			Console.WriteLine("Options:");
			Console.WriteLine(" -s:<server name>");
			Console.WriteLine(" -d:<database name>");
			Console.WriteLine(" -u:<user name>");
			Console.WriteLine(" -w:<user password>");
			Console.WriteLine(" -e:<error indicators>");
            Console.WriteLine(" -m:<connection manager>");
			Console.WriteLine(string.Empty);
			Console.WriteLine("Error Indicators (Binary parameter):");
			Console.WriteLine(" 1 - The application exists with a failure if any script failed");
			Console.WriteLine(" 2 - The application stops if a scripts fails");
			Console.WriteLine(string.Empty);
            Console.WriteLine("Connection Manager:");
            Console.WriteLine(" usage: -m:[o|p|s|t|r]");
            Console.WriteLine(" Connection manager types:");
            Console.WriteLine("  [o] Optimistic  - Non-transactional, all scripts are executed in a single connection");
            Console.WriteLine("  [p] Pessimistic - Non-transactional, checks that scripts dont leave a transaction open");
            Console.WriteLine("  [s] Strict      - Non-transactional, each script uses its own connection");
            Console.WriteLine("  [c] Commit      - Transactional, scripts are executed in a transaction");
            Console.WriteLine("  [r] Rollback    - Transactional, scripts are executed in a transaction that is rollback");
            Console.WriteLine(string.Empty);
			Console.WriteLine("Example:");
			Console.WriteLine(" Execute the 'test' project against the 'casa' database in the local SQL Server");
			Console.WriteLine(" Report if any script failed and dont keep running any other script after a failure");
            Console.WriteLine(" A Strict connection manager is used when the scripts are executed.");
			Console.WriteLine(@" SQLRunnerCommand.exe -s:localhost -d:casa -p:c:\test.sqlrunner -e:3 -m:s");
			Console.WriteLine(string.Empty);
		}
	}
}
